<template>
  <div>
    <span v-for="(item,index) in arr" :key="index">
      <input type="checkbox" :disabled="bool" @click="add(index)" />
      {{item}}
    </span>
    <ul>
      <li v-for="(item,index) in newArr" :key="index">{{item}}</li>
    </ul>
  </div>
</template>

<script>
export default {
  data() {
    return {
      bool: false,
      arr: ["科幻", "喜剧", "动漫", "冒险", "科技", "军事", "娱乐", "奇闻"],
      newArr: []
    };
  },

  methods: {
    add(num) {
      const i = this.newArr.findIndex(item => item == this.arr[num]);
      if (i != -1) {
        this.newArr.splice(i, 1);
      } else {
        this.newArr.push(this.arr[num]);
      }
    }
  }
};
</script>

<style>
</style>